﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;


namespace RadioThermostat.Common
{
    public class Email
    {
       


            public static void Send(string subject, string message, string user, string password, 
                string[] recipients, bool useBCC, string mailFrom)
            {
                MailMessage mail = new MailMessage();
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "smtp.comcast.net";
                smtp.Credentials = new System.Net.NetworkCredential(user,password);
                mail.From = new MailAddress(mailFrom);

                if (useBCC)
                {
                    foreach (string recipient in recipients)
                    {
                        mail.Bcc.Add(recipient);
                    }
                }
                else
                {
                    foreach (string recipient in recipients)
                    {
                        mail.To.Add(recipient);
                    }
                }
               
                mail.Subject = subject;
                mail.Body = message;
                smtp.Send(mail);  

            }
    }
}
